package com.weakteam.orderonline.dataresource.service;

import com.weakteam.orderonline.dataresource.dao.ClientOrderDAO;
import com.weakteam.orderonline.dataresource.domain.ClientOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Nail
 */

@Service
public class ClientOrderServiceImpl implements ClientOrderService {

    @Autowired
    private ClientOrderDAO clientOrderDAO;

    @Override
    public List<ClientOrder> getAll() {
        return clientOrderDAO.getAll();
    }

    @Override
    public ClientOrder getById(Integer id) {
        return clientOrderDAO.getById(id);
    }

    @Transactional
    @Override
    public void save(ClientOrder clientOrder) {
        clientOrderDAO.save(clientOrder);
    }

    @Transactional
    @Override
    public boolean delete(Integer id) {
        return clientOrderDAO.delete(id);
    }
}
